import Vue from 'vue'
import App from './App.vue'

// 全局组件：导航、轮播、分页
import TypeNav from '@/components/typeNav';
import Carousel from '@/components/carousel';
import Pagination from '@/components/pagination';

Vue.component(TypeNav.name, TypeNav);
Vue.component(Carousel.name, Carousel);
Vue.component(Pagination.name, Pagination);


Vue.config.productionTip = false;

// elementUI按需引入
import { Button, MessageBox, Input, } from 'element-ui';
Vue.component(Button.name, Button);
Vue.component(Input.name, Input);
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// 引入路由
import router from "@/router";
// 注册仓库功能
import store from './store';

//引入mockServe文件,让咱们模拟接口跑起来
import './mock/mockServe';

// 引入swiper样式
import 'swiper/css/swiper.min.css';
// 引入icon图表库样式
import '@/assets/icon/iconfont.css';

// --------------------------------------------------------------------------------------------
// 测试接口
// import {reqgetDetailInfo} from "@/api"
// reqgetDetailInfo();
// --------------------------------------------------------------------------------------------

// 全局引入api
import * as API from '@/api';

// 表单验证vee-validate引入
import "@/plugins/validate";

// 图片懒加载全局引入
import VueLazyload from 'vue-lazyload';
import loadimage from '@/assets/images/lazyload.gif';
Vue.use(VueLazyload, {
  loading: loadimage
})

new Vue({
  render: h => h(App),
  // 全局事件总线配置$bus
  beforeCreate(){
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API;
  },
  // 注册路由
  // $route(路由):可以获取到路由信息(path、query、params)
  //$router:进行编程式导航路由跳转push||replace
  router,
  store
}).$mount('#app')
